<template>
    <div class="table">
        <!--主体-->
        <div class="container">
            <!--搜索-->
            <div class="handle-box">
                <el-row>
                    <el-col :span="17">
                        <el-input v-model="select_word" placeholder="筛选关键词" class="handle-input mr10"
                                  @keyup.enter.native="search">
                            <i slot="prefix" class="el-input__icon el-icon-search"></i>
                        </el-input>
                        <el-button type="primary" icon="search" @click="search">搜索</el-button>
                        <el-button class="btn" size="small" @click="handleEdit2()">批量标注</el-button>
                    </el-col>
                    <el-col :span="7">
                        <div style="font-size: 12px;color: #999;display: inline-block;">
                            <span style="font-size: 20px">涉及文档数约为</span>
                            <span style="padding: 0 5px">≈</span>
                            <span style="font-size: 20px;display: inline-block;width: 100px">{{Quantity}}</span>
                        </div>
                    </el-col>
                </el-row>
                <div style="padding-top: 10px">
                    <span style="padding: 0 10px"><el-radio v-model="check" label="2">全部</el-radio></span>
                    <span style="padding: 0 10px"><el-radio v-model="check" label="0">未登记</el-radio></span>
                    <span style="padding: 0 10px"><el-radio v-model="check" label="1">已登记</el-radio></span>
                </div>
            </div>
            <!--列表-->
            <div>
                <ul class="author-list">
                    <li class="clear" v-for="(Data,index) in Data">
                        <div class="author-list-title">
                            <router-link class="a"
                                         :to="{path:'segmentation',query:{id:Data.query_data.label.id,select:Data.select}}">
                                <h3><span v-for="Data in (Data.query_data.title)" v-html="Data"></span></h3>
                            </router-link>
                        </div>
                        <div class="author-list-title">
                            <span style="font-size: 13px;padding-top: 10px;display: inline-block"
                                  v-for="Data in (Data.highlight.fullcontentcn)" v-html="Data"></span>
                        </div>
                        <div style="padding-top: 10px">
                            <el-tag style="margin-right: 5px;margin-bottom: 5px" size="small" v-for="tags in Data.tags"
                                    v-if="Data.hasOwnProperty('tags')">{{tags}}
                            </el-tag>
                            <el-tag size="small" v-else></el-tag>
                        </div>
                        <span class="num num1">来源：{{Data.query_data.source}} - </span>

                        <span class="num num1" v-if="Data.query_data.source =='移植网'">
                            <a style="text-decoration: underline" target="_blank"
                               :href="'http://bbs.transplantation.org.cn/forum.php?mod=viewthread&tid='+Data.query_data.label.id+'&extra=page%3D1'">{{Data.query_data.label.id}}</a> -
                        </span>

                        <span class="num num1" v-else-if="Data.query_data.source =='好大夫_肾移植'">
                            <a style="text-decoration: underline" target="_blank"
                               :href="'https://www.haodf.com/wenda/'+Data.query_data.label.id+'.htm'">{{Data.query_data.label.id}}</a> -
                        </span>

                        <span class="num num1" v-else>
                            <a style="text-decoration: underline" target="_blank"
                               :href="'http://tieba.baidu.com/p/'+Data.query_data.label.id">{{Data.query_data.label.id}}</a> -
                        </span>

                        <el-button class="btn" size="small" @click="handleEdit(index,Data.query_data)">标注数据</el-button>
                        <span> - </span>
                        <span class="num num1" v-if="Data.query_data.status== 0">未标注</span>
                        <span class="num num1" v-if="Data.query_data.status== 1" style="color: red">已标注</span>
                        <span> - </span>
                        <span class="num num1" v-if="Data.query_data.is_ae== 0"><el-button class="btn" size="small"
                                                                                           @click="register(index,Data.query_data)">未登记</el-button></span>
                        <span class="num num1" v-if="Data.query_data.is_ae== 1" style="color: red">已登记</span>
                    </li>
                </ul>
            </div>
            <!--Vue组件-->
            <el-row :gutter="20">
                <el-col :offset="13">
                    <div class="page-bar">
                        <ul>
                            <li v-if="cur>1"><a @click="cur--,pageClick()">上一页</a></li>
                            <li v-if="cur==1"><a class="banclick">上一页</a></li>
                            <li v-for="index in indexs" :class="{ 'active': cur == index}">
                                <a @click="btnClick(index)">{{ index }}</a>
                            </li>
                            <li v-if="cur!=all"><a @click="cur++,pageClick()">下一页</a></li>
                            <li v-if="cur == all"><a class="banclick">下一页</a></li>
                            <li><a>共<i>{{all}}</i>页</a></li>
                        </ul>
                    </div>
                </el-col>
            </el-row>
        </div>
        <!-- 标注弹出框 -->
        <el-dialog title="标注" :visible.sync="editVisible" width="40%">
            <el-form ref="form" :model="form" label-width="100px">
                <el-form-item label="ID">
                    <el-input v-model="form.id" disabled></el-input>
                </el-form-item>
                <el-form-item label="内容">
                    <el-input
                        type="textarea"
                        :rows="4"
                        disabled
                        v-model="form.label.context">
                    </el-input>
                </el-form-item>
                <el-form-item label="标注话题">
                    <el-tree
                        :data="data"
                        show-checkbox
                        node-key="id"
                        ref="tree"
                        :default-checked-keys="default_checked"
                        :props="defaultProps">
                    </el-tree>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="editVisible = false">取 消</el-button>
                <el-button type="primary" @click="saveEdit">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 批量标注弹出框 -->
        <el-dialog title="批量标注" :visible.sync="editVisible2" width="40%">
            <el-row :gutter="20">
                <el-col :span="6">
                    <el-radio v-model="radio" label="1">批量覆盖</el-radio>
                </el-col>
                <el-col :span="6">
                    <el-radio v-model="radio" label="2">批量追加</el-radio>
                </el-col>
                <el-col :span="6">
                    <el-radio v-model="radio" label="3">批量删除</el-radio>
                </el-col>
                <el-col :span="6">
                    <el-radio v-model="radio" label="4">重置</el-radio>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                <el-col :span="8">
                    <div class="grid-content grid-con-1">
                        <div class="grid-cont-right">
                            <div class="grid-num">{{Quantity}}</div>
                            <div style="font-size: 18px;font-weight: bold;">涉及文档数约为</div>
                        </div>
                    </div>
                </el-col>
                <el-col :span="8">
                    <div class="grid-content grid-con-2">
                        <div class="grid-cont-right">
                            <div class="grid-num">{{number}}</div>
                            <div style="font-size: 18px;font-weight: bold;">已标注</div>
                        </div>
                    </div>
                </el-col>
                <el-col :span="8">
                    <div class="grid-content grid-con-3">
                        <div class="grid-cont-right">
                            <div class="grid-num"><span v-if=" number>10 "> > </span>{{time}}</div>
                            <div style="font-size: 18px;font-weight: bold;">需要时间/秒</div>
                        </div>
                    </div>
                </el-col>
            </el-row>
            <p style="padding: 10px 0">
                <el-tag style="margin-bottom: 5px;margin-right: 5px" v-for="tag in tag" size="mini">{{tag.label}}
                </el-tag>
            </p>
            <p>标注话题</p>
            <el-tree
                @check-change="handleCheckChange"
                :data="data"
                show-checkbox
                node-key="id"
                ref="tree2"
                :default-checked-keys="default_checked2"
                :props="defaultProps2">
            </el-tree>
            <span slot="footer" class="dialog-footer">
                <el-button @click="editVisible2 = false">取 消</el-button>
                <el-button type="primary" @click="saveEdit2">确 定</el-button>
            </span>
        </el-dialog>
        <!--秒表时间弹出框-->
        <el-dialog modal :close-on-click-modal="true" id="editVisible3" title="批量标注" :visible.sync="editVisible3"
                   width="40%" style="text-align: center">
            <p style="color: red;font-size: 16px;text-align: center;padding-bottom: 10px">数据处理中，请不要刷新或关闭网页！</p>
            <el-row :gutter="20">
                <el-col :span="12" style=";padding-top: 25px;height: 200px;">
                    <second ref="ref"></second>
                </el-col>
                <el-col :span="12" style="border-left: 1px solid #ccc;padding-top: 30px;height: 200px;">
                    <p>
                        请您耐心等待！系统正在为您批量处理，您的等待将会在后续的搜索中得到回报。惠每移健的数据平台，采用的是搜索引擎技术，它将最大化的为您提供快速搜索，快速定位数据。
                    </p>
                </el-col>
            </el-row>
        </el-dialog>
    </div>
</template>

<script>
    import second from './second'

    export default {
        components: {
            second
        },
        data() {
            return {
                select_word: '',
                searchUrl: 'http://bigdata-api.huimeimt.cn/resource_server/tiebamdm/kwd_query/',
                Data: [],
                /*Vue组件*/
                all: 1,
                cur: 1,
                /*获取token*/
                access_token: '',
                /*数量*/
                Quantity: '0',
                postBar: '贴吧',
                /*标注*/
                editVisible: false,
                defaultProps: {children: 'children', label: 'label'},
                default_checked: [],
                form: {
                    status: '',
                    category: '',
                    good: '',
                    kwords: [],
                    title: '',
                    author: '',
                    reply_num: '',
                    uri: '',
                    label: {
                        context: '',
                        id: '',
                    },
                    source: '',
                    index_num: '',
                    reply: [],
                    author_id: '',
                    total: '',
                    is_ae: '',
                    id: '',
                },
                data: [
                    {
                        "children": [{"id": 1, "label": "症状描述"},
                            {"id": 2, "label": "透析话题"},
                            {"id": 3, "label": "就诊医院选择"},
                            {"id": 4, "label": "医生选择"},
                            {"id": 5, "label": "经济求助"},
                            {"id": 6, "label": "配型检查"},
                            {"id": 7, "label": "移植流程"},
                            {"id": 8, "label": "等待肾源"},
                            {"id": 9, "label": "价格咨询"},
                            {"id": 10, "label": "移植方案选择"},
                            {"id": 11, "label": "移植适合度讨论"},
                            {"id": 12, "label": "认知期药品话题"}],
                        "id": 999,
                        "label": "认知考虑期"
                    },
                    {
                        "children": [
                            {
                                "children": [
                                    {
                                        "children": [
                                            {"id": 13, "label": "病史描述"},
                                            {"id": 14, "label": "术前影像学检查"},
                                            {"id": 15, "label": "术前血液检查"},
                                            {"id": 16, "label": "术前尿液检查"},
                                            {"id": 17, "label": "术前常规检查"},
                                            {"id": 18, "label": "术前肝肾功能检查"},
                                            {"id": 19, "label": "术前免疫组学检查"},
                                            {"id": 20, "label": "术前病理学检查"}
                                        ],
                                        "id": 994,
                                        "label": "术前检查"
                                    }
                                ],
                                "id": 996,
                                "label": "术前准备"
                            },
                            {
                                "children": [{"id": 21, "label": "麻醉"},
                                    {"id": 22, "label": "手术风险评估"},
                                    {"id": 23, "label": "术中药品"}],
                                "id": 9955,
                                "label": "术中"
                            }
                        ],
                        "id": 998,
                        "label": "围手术期"
                    },
                    {
                        "children": [
                            {
                                "children": [
                                    {
                                        "children": [{"id": 24, "label": "术后影像学检查"},
                                            {"id": 25, "label": "术后血液检查"},
                                            {"id": 26, "label": "术后尿液检查"},
                                            {"id": 27, "label": "术后常规检查"},
                                            {"id": 28, "label": "术后肝肾功能检查"},
                                            {"id": 29, "label": "术后免疫抑制剂血药浓度检查"},
                                            {"id": 30, "label": "术后组织学检查"},
                                            {"id": 31, "label": "术后病理学检查"},
                                            {"id": 32, "label": "术后肿瘤筛查"},
                                            {"id": 33, "label": "术后心血管筛查"},
                                            {"id": 34, "label": "术后其他疾病筛查"}],
                                        "id": 9995,
                                        "label": "检查"
                                    }
                                ],
                                "id": 9925,
                                "label": "随访与复查"
                            },
                            {
                                "children": [
                                    {
                                        "children": [{"id": 35, "label": "药效"},
                                            {"id": 36, "label": "经济性"},
                                            {"id": 37, "label": "安全性"},
                                            {"id": 38, "label": "副作用"},
                                            {"id": 39, "label": "适应症"},
                                            {"id": 40, "label": "禁忌症"},
                                            {"id": 41, "label": "依从性"},
                                            {"id": 42, "label": "药物相互作用"},
                                            {"id": 43, "label": "药品选择"},
                                            {"id": 44, "label": "药品买卖"},
                                            {"id": 45, "label": "购药途径"},
                                            {"id": 46, "label": "国外仿制药"}],
                                        "id": 9965,
                                        "label": "术后药品"
                                    }
                                ],
                                "id": 91095,
                                "label": "术后用药"
                            },
                            {
                                "children": [
                                    {
                                        "children": [{"id": 47, "label": "排斥反应"},
                                            {"id": 48, "label": "代谢性疾病"},
                                            {"id": 49, "label": "抗感染"},
                                            {"id": 50, "label": "心血管并发症"},
                                            {"id": 51, "label": "高尿酸血症"},
                                            {"id": 52, "label": "肾功能障碍"},
                                            {"id": 53, "label": "新发肿瘤"},
                                            {"id": 54, "label": "其他并发症"}],
                                        "id": 1995,
                                        "label": "并发症类型"
                                    },
                                    {
                                        "children": [
                                            {"id": 55, "label": "药效"},
                                            {"id": 56, "label": "经济性"},
                                            {"id": 57, "label": "安全性"},
                                            {"id": 58, "label": "副作用"},
                                            {"id": 59, "label": "适应症"},
                                            {"id": 60, "label": "禁忌症"},
                                            {"id": 61, "label": "依从性"},
                                            {"id": 62, "label": "药物相互作用"},
                                            {"id": 63, "label": "药品买卖"},
                                            {"id": 64, "label": "国外仿制药"}],
                                        "id": 995,
                                        "label": "并发症药品"
                                    }
                                ],
                                "id": 9961,
                                "label": "并发症"
                            },
                            {
                                "children": [{"id": 65, "label": "疾病复发"},
                                    {"id": 66, "label": "降低复发率"}],
                                "id": 99,
                                "label": "复发"
                            },
                            {
                                "children": [
                                    {
                                        "children": [{"id": 67, "label": "饮食禁忌"},
                                            {"id": 68, "label": "饮食建议"}],
                                        "id": 99511,
                                        "label": "饮食"
                                    },
                                    {
                                        "children": [{"id": 69, "label": "运动禁忌"},
                                            {"id": 70, "label": "运动建议"}],
                                        "id": 995111,
                                        "label": "运动"
                                    },
                                    {"id": 71, "label": "情感"},
                                    {"id": 72, "label": "性生活"},
                                    {"id": 73, "label": "生育"},
                                    {"id": 74, "label": "工作"}
                                ],
                                "id": 9951111,
                                "label": "生活管理"
                            }
                        ],
                        "id": 9971,
                        "label": "移植手术后"
                    }
                ],
                select: '',
                children: [
                    {
                        "1": "症状描述"
                    },
                    {
                        "2": "透析话题"
                    },
                    {
                        "3": "就诊医院选择"
                    },
                    {
                        "4": "医生选择"
                    },
                    {
                        "5": "经济求助"
                    },
                    {
                        "6": "配型检查"
                    },
                    {
                        "7": "移植流程"
                    },
                    {
                        "8": "等待肾源"
                    },
                    {
                        "9": "价格咨询"
                    },
                    {
                        "10": "移植方案选择"
                    },
                    {
                        "11": "移植适合度讨论"
                    },
                    {
                        "12": "认知期药品话题"
                    },
                    {
                        "999": "认知考虑期"
                    },
                    {
                        "13": "病史描述"
                    },
                    {
                        "14": "术前影像学检查"
                    },
                    {
                        "15": "术前血液检查"
                    },
                    {
                        "16": "术前尿液检查"
                    },
                    {
                        "17": "术前常规检查"
                    },
                    {
                        "18": "术前肝肾功能检查"
                    },
                    {
                        "19": "术前免疫组学检查"
                    },
                    {
                        "20": "术前病理学检查"
                    },
                    {
                        "994": "术前检查"
                    },
                    {
                        "996": "术前准备"
                    },
                    {
                        "21": "麻醉"
                    },
                    {
                        "22": "手术风险评估"
                    },
                    {
                        "23": "术中药品"
                    },
                    {
                        "9955": "术中"
                    },
                    {
                        "998": "围手术期"
                    },
                    {
                        "24": "术后影像学检查"
                    },
                    {
                        "25": "术后血液检查"
                    },
                    {
                        "26": "术后尿液检查"
                    },
                    {
                        "27": "术后常规检查"
                    },
                    {
                        "28": "术后肝肾功能检查"
                    },
                    {
                        "29": "术后免疫抑制剂血药浓度检查"
                    },
                    {
                        "30": "术后组织学检查"
                    },
                    {
                        "31": "术后病理学检查"
                    },
                    {
                        "32": "术后肿瘤筛查"
                    },
                    {
                        "33": "术后心血管筛查"
                    },
                    {
                        "34": "术后其他疾病筛查"
                    },
                    {
                        "9995": "检查"
                    },
                    {
                        "9925": "随访与复查"
                    },
                    {
                        "9965": "术后药品"
                    },
                    {
                        "91095": "术后用药"
                    },
                    {
                        "1995": "并发症类型"
                    },
                    {
                        "35": "药效"
                    },
                    {
                        "36": "经济性"
                    },
                    {
                        "37": "安全性"
                    },
                    {
                        "38": "副作用"
                    },
                    {
                        "39": "适应症"
                    },
                    {
                        "40": "禁忌症"
                    },
                    {
                        "41": "依从性"
                    },
                    {
                        "42": "药物相互作用"
                    },
                    {
                        "43": "药品选择"
                    },
                    {
                        "44": "药品买卖"
                    },
                    {
                        "45": "购药途径"
                    },
                    {
                        "46": "国外仿制药"
                    },
                    {
                        "47": "排斥反应"
                    },
                    {
                        "48": "代谢性疾病"
                    },
                    {
                        "49": "抗感染"
                    },
                    {
                        "50": "心血管并发症"
                    },
                    {
                        "51": "高尿酸血症"
                    },
                    {
                        "52": "肾功能障碍"
                    },
                    {
                        "53": "新发肿瘤"
                    },
                    {
                        "54": "其他并发症"
                    },
                    {
                        "55": "药效"
                    },
                    {
                        "56": "经济性"
                    },
                    {
                        "57": "安全性"
                    },
                    {
                        "58": "副作用"
                    },
                    {
                        "59": "适应症"
                    },
                    {
                        "60": "禁忌症"
                    },
                    {
                        "61": "依从性"
                    },
                    {
                        "62": "药物相互作用"
                    },
                    {
                        "63": "药品买卖"
                    },
                    {
                        "64": "国外仿制药"
                    },
                    {
                        "995": "并发症药品"
                    },
                    {
                        "9961": "并发症"
                    },
                    {
                        "99": "复发"
                    },
                    {
                        "99511": "饮食"
                    },
                    {
                        "995111": "运动"
                    },
                    {
                        "9951111": "生活管理"
                    },
                    {
                        "9971": "移植手术后"
                    },
                    {
                        "65": "疾病复发"
                    },
                    {
                        "66": "降低复发率"
                    },
                    {
                        "67": "饮食禁忌"
                    },
                    {
                        "68": "饮食建议"
                    },
                    {
                        "69": "运动禁忌"
                    },
                    {
                        "70": "运动建议"
                    },
                    {
                        "71": "情感"
                    },
                    {
                        "72": "性生活"
                    },
                    {
                        "73": "生育"
                    },
                    {
                        "74": "工作"
                    }
                ],
                /*批量标注*/
                editVisible2: false,
                defaultProps2: {children: 'children', label: 'label'},
                default_checked2: [],
                number: '0',
                tag: [],
                time: '',
                editVisible3: false,
                radio: '1',
                p_status: '',
                check: '2',
            }
        },
        created() {
            this.gainTtoken();
            if (this.$route.query.select) {
                this.select = this.$route.query.select;
                this.select_word = this.select;
                setTimeout(() => {
                    this.req(this.searchUrl + this.select_word + "?access_token=" + this.access_token + "&page=" + this.cur + "&tbName=" + this.postBar)
                }, 1000);
            }
        },
        methods: {
            /*获取token*/
            gainTtoken() {
                this.$axios({
                    method: 'GET',
                    url: 'http://bigdata-oauth.huimeimt.cn/Dataplatform/token',
                }).then((res) => {
                    this.access_token = res.data.access_token
                })
            },
            search() {
                if (this.excludeSpecial(this.select_word) != "") {
                    if (this.check != 2) {
                        this.cur = 1;
                        let Url = this.searchUrl + this.select_word + "?access_token=" + this.access_token + "&page=" + this.cur + "&tbName=" + this.postBar + "&ae=" + this.check;
                        this.req(Url)
                    } else {
                        this.cur = 1;
                        this.req(this.searchUrl + this.select_word + "?access_token=" + this.access_token + "&page=" + this.cur + "&tbName=" + this.postBar)
                    }
                } else {
                    this.$message({
                        message: '请输入关键词！',
                        type: 'warning'
                    });
                }
            },
            handleEdit(index, row) {
                const item = row;
                this.form = {
                    status: item.status,
                    category: item.category,
                    good: item.good,
                    kwords: item.kwords,
                    title: item.title,
                    author: item.author,
                    reply_num: item.reply_num,
                    uri: item.uri,
                    label: {
                        context: item.label.context,
                        id: item.label.id,
                    },
                    source: item.source,
                    reply: item.reply,
                    author_id: item.author_id,
                    id: item.id,
                    index_num: item.index_num,
                    is_ae: item.is_ae,
                    total: item.total,
                };
                this.editVisible = true;
                this.A();
            },
            A() {
                let text = [];
                if (this.form.status == "0") {
                    setTimeout(() => {
                        this.$refs.tree.setCheckedKeys([]);
                    }, 0);
                } else {
                    for (var i = 0; i < this.form.kwords.length; i++) {
                        text.push(this.form.kwords[i]);
                    }
                    setTimeout(() => {
                        this.$refs.tree.setCheckedKeys(text);
                    }, 0);
                }
            },
            saveEdit() {
                this.form.kwords = this.$refs.tree.getCheckedKeys();
                this.form.kwords = this.form.kwords.join(',').split(',');
                if (this.form.kwords.length > 1) {
                    this.form.status = "1";
                    this.post()
                } else {
                    this.form.status = "0";
                    this.post()
                }
            },
            register(index, row) {
                const item = row;
                this.form = {
                    status: item.status,
                    category: item.category,
                    good: item.good,
                    kwords: item.kwords,
                    title: item.title,
                    author: item.author,
                    reply_num: item.reply_num,
                    uri: item.uri,
                    label: {
                        context: item.label.context,
                        id: item.label.id,
                    },
                    source: item.source,
                    reply: item.reply,
                    author_id: item.author_id,
                    id: item.id,
                    index_num: item.index_num,
                    is_ae: item.is_ae,
                    total: item.total,
                };
                if (this.form.is_ae == 0) {
                    this.form.is_ae = "1";
                    this.$axios({
                        method: 'POST',
                        headers: {'Content-Type': 'application/json;charset=UTF-8'},
                        data: JSON.stringify(this.form),
                        url: "http://bigdata-api.huimeimt.cn/resource_server/tiebamdm/update_biaozhu" + "?access_token=" + this.access_token,
                    }).then((res) => {
                        setTimeout(() => {
                            this.req(this.searchUrl + this.select_word + "?access_token=" + this.access_token + "&page=" + this.cur + "&tbName=" + this.postBar)
                        }, 500);
                    })
                }
            },
            handleEdit2(index, row) {
                if (this.Quantity != 0) {
                    this.editVisible2 = true;
                    this.time = parseInt(this.Quantity / 36)
                } else {
                    this.$message({
                        message: '请查询数据！',
                        type: 'warning'
                    })
                }
            },
            saveEdit2() {
                if (this.radio != 4) {
                    this.p_status = "1"
                } else {
                    this.p_status = "0"
                }
                let kwords = {
                    "kwords": this.$refs.tree2.getCheckedKeys().join(',').split(','),
                    "status": this.p_status,
                    "radio": this.radio,
                };
                this.editVisible2 = false;
                this.editVisible3 = true;
                setTimeout(() => {
                    this.$refs.ref.startTime()
                }, 0);
                this.$axios({
                    method: 'POST',
                    headers: {'Content-Type': 'application/json;charset=UTF-8'},
                    data: JSON.stringify(kwords),
                    url: "http://bigdata-api.huimeimt.cn/resource_server/tiebamdm/batch_update" + "?access_token=" + this.access_token + "&kwd=" + this.select_word + "&tbName=" + this.postBar,
                }).then((res) => {
                    this.search();
                    /*this.editVisible3 = false;*/
                    setTimeout(() => {
                        this.$refs.ref.clearTime()
                    }, 0)
                })
            },
            handleCheckChange(data, checked, indeterminate) {
                this.number = this.$refs.tree2.getCheckedKeys().length;
                let a = [];
                a = this.$refs.tree2.getCheckedNodes();
                if (checked == true) {
                    this.tag = a
                } else if (checked == false) {
                    this.tag = a
                }
                if (this.Quantity > 36 && this.number > 10) {
                    this.time = parseInt(this.Quantity / 36)
                } else {
                    this.time = parseInt(10)
                }
            },
            post() {
                this.$axios({
                    method: 'POST',
                    headers: {'Content-Type': 'application/json;charset=UTF-8'},
                    data: JSON.stringify(this.form),
                    url: "http://bigdata-api.huimeimt.cn/resource_server/tiebamdm/update_biaozhu" + "?access_token=" + this.access_token,
                }).then((res) => {
                    if (res.data.result != "") {
                        this.editVisible = false;
                        this.$message.success(`标注成功`);
                        this.$refs.tree.setCheckedKeys([]);
                        setTimeout(() => {
                            this.req(this.searchUrl + this.select_word + "?access_token=" + this.access_token + "&page=" + this.cur + "&tbName=" + this.postBar)
                        }, 1000);
                    }
                })
            },
            /*Vue组件*/
            btnClick(data) {
                if (data != this.cur) {
                    this.cur = data;
                    this.req(this.searchUrl + this.select_word + "?access_token=" + this.access_token + "&page=" + this.cur + "&tbName=" + this.postBar)
                }
            },
            pageClick() {
                this.req(this.searchUrl + this.select_word + "?access_token=" + this.access_token + "&page=" + this.cur + "&tbName=" + this.postBar)
            },
            removeDuplicatedItem(arr) {
                for (var i = 0; i < arr.length - 1; i++) {
                    for (var j = i + 1; j < arr.length; j++) {
                        if (arr[i] == arr[j]) {
                            8
                            arr.splice(j, 1);
                            j--;
                        }
                    }
                }
                return arr;
            },
            /*GET请求*/
            req(Url) {
                this.$axios({
                    method: 'GET',
                    headers: {'Content-Type': 'application/json;charset=UTF-8'},
                    url: Url,
                }).then((res) => {

                    console.log(res)

                    if (res.data.result.length > 0) {
                        TweenLite.to(this.$data, 0.5, {Quantity: res.data.result[0].query_data.total});
                        this.all = Math.round(res.data.result[0].query_data.total / 20);
                        this.Data = res.data.result;
                        let returnDataList = this.Data;
                        let allTagsList = this.children;
                        for (let i = 0; i < returnDataList.length; i++) {
                            var tags = new Array()
                            let allKwords = returnDataList[i].query_data.kwords;
                            for (let k = 0; k < allKwords.length; k++) {
                                let oneTagNum = allKwords[k];
                                for (var key in allTagsList) {
                                    if (key == oneTagNum) {
                                        let tagName = allTagsList[key];
                                        for (var key2 in tagName) {
                                            let tgn = tagName[key2];
                                            tags.push(tgn);
                                            tgn = '';
                                        }
                                    }
                                }
                            }
                            returnDataList[i]['select'] = this.select_word;
                            this.removeDuplicatedItem(tags);
                            returnDataList[i]['tags'] = tags;
                        }
                    } else {
                        this.all = 0;
                        this.$message({
                            message: '无数据！',
                            type: 'warning'
                        });
                    }
                });
            },
            /*去除非法字符*/
            excludeSpecial(s) {
                s = s.replace(/[^\u4e00-\u9fa5a-zA-Z0-9\w]/g, ' ');
                return s;
            },
        },
        computed: {
            indexs() {
                let left = 1;
                let right = this.all;
                let ar = [];
                if (this.all >= 5) {
                    if (this.cur > 3 && this.cur < this.all - 2) {
                        left = this.cur - 2;
                        right = this.cur + 2
                    } else {
                        if (this.cur <= 3) {
                            left = 1;
                            right = 5
                        } else {
                            right = this.all;
                            left = this.all - 4
                        }
                    }
                }
                while (left <= right) {
                    ar.push(left);
                    left++
                }
                return ar
            },
        },
    }
</script>

<style scoped>
    .handle-input {
        width: 300px;
        display: inline-block;
    }

    .grid-content {
        display: flex;
        align-items: center;
        height: 100px;
    }

    .grid-num {
        font-size: 25px;
        font-weight: bold;
    }

    .grid-cont-right {
        flex: 1;
        text-align: center;
        font-size: 12px;
        color: #999;
    }

    ul, li {
        margin: 0;
        padding: 0;
    }

    li {
        list-style: none
    }

    .author-list {
        padding: 0 10px;
        background-color: #fff;
    }

    .author-list > .clear {
        padding: 10px 0;
        border-bottom: 1px solid #ebebeb;
    }

    .author-list-title {
        margin-bottom: 5px;
    }

    .author-list-title > .num {
        font-size: 14px;
        font-weight: 700;

    }

    .num1 {
        font-size: 13px;
        padding-top: 20px;
        display: inline-block
    }

    .author-list-title > .num1 {
        padding-left: 20px;
    }

    .author-list-title > .a {
        font-size: 14px;
        font-weight: bold;
        text-decoration: underline;
    }

    .author-list-title > a:visited {
        color: blue;
        text-decoration: underline;
    }

    .author-list-type, .author-list-type-info, .author-list-keyword {
        line-height: 18px;
        font-size: 12px;
    }

    .btn {
        background: none;
    }

    .grid-con-1 .grid-con-icon {
        background: rgb(45, 140, 240);
    }

    .grid-con-1 .grid-num {
        color: rgb(45, 140, 240);
    }

    .grid-con-2 .grid-con-icon {
        background: rgb(100, 213, 114);
    }

    .grid-con-2 .grid-num {
        color: rgb(100, 213, 114);
    }

    .grid-con-3 .grid-con-icon {
        background: rgb(242, 94, 67);
    }

    .grid-con-3 .grid-num {
        color: rgb(242, 94, 67);
    }

    /*分页开始*/
    .page-bar {
        margin: 40px;
    }

    .page-bar li:first-child > a {
        margin-left: 0px
    }

    .page-bar a {
        border: 1px solid #ddd;
        text-decoration: none;
        position: relative;
        float: left;
        padding: 6px 12px;
        margin-left: -1px;
        line-height: 1.42857143;
        color: #337ab7;
        cursor: pointer
    }

    .page-bar a:hover {
        background-color: #eee;
    }

    .page-bar a.banclick {
        cursor: not-allowed;
    }

    .page-bar .active a {
        color: #fff;
        cursor: default;
        background-color: #337ab7;
        border-color: #337ab7;
    }

    .page-bar i {
        font-style: normal;
        color: #d44950;
        margin: 0 4px;
        font-size: 12px;
    }

    /*分页结束*/
</style>
<style>
    #editVisible3 .el-dialog__body {
        padding: 10px 20px 30px;
    }

    #editVisible3 .el-dialog__headerbtn {
        display: none;
    }
</style>
